/*
 * Powered By xTOOLs
 * Dev by tao.li8@pactera.com
 * Copyright ©2009-2018 pactera.com All rights reserved.
 *
 * Generated at 2020-7-6 18:45:10
 */

package com.pactera.jep.service.yapin.coll.service.impl;

import com.github.pagehelper.PageInfo;
import com.pactera.jep.orm.Operator;
import com.pactera.jep.orm.mybatis.entity.EntityFilter;
import com.pactera.jep.service.yapin.coll.model.ValueInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pactera.jep.orm.mybatis.mapper.Mapper;
import com.pactera.jep.orm.mybatis.service.MyBatisCRUDService;

import com.pactera.jep.service.yapin.coll.mapper.InsurenceInfoMapper;
import com.pactera.jep.service.yapin.coll.service.InsurenceInfoService;
import com.pactera.jep.service.yapin.coll.model.InsurenceInfo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 服务层实现
 * @author YourName
 * @date 2020-7-6 18:45:10
 */
@Service
@Transactional(readOnly = true)
public class InsurenceInfoServiceImpl extends MyBatisCRUDService<InsurenceInfo, String> implements InsurenceInfoService {

    Logger logger =  LoggerFactory.getLogger(getClass());

    @Autowired
    private InsurenceInfoMapper			insurenceInfoMapper;

    @Override
    public Mapper<InsurenceInfo, String> getMapper() {
         return insurenceInfoMapper;
    }

    @Override
    public Map<String, Object> getInsuranceInfoByCltNo(String cltNo) {
        List<EntityFilter> list = new ArrayList<>();
        list.add(new EntityFilter(InsurenceInfo.class,"cltNo", Operator.EQ,cltNo));
        List<InsurenceInfo> insurenceInfos = insurenceInfoMapper.selectByFilter(list);
        PageInfo<InsurenceInfo> pageInfo = new PageInfo<>(insurenceInfos);
        List<InsurenceInfo> insurenceInfosList = pageInfo.getList();
        Map<String, Object> result = new HashMap();
        result.put("total",pageInfo.getTotal());
        result.put("rows",insurenceInfosList);
        return result;
    }
}
